package com.gztms.blogmgnt.controller;

import com.gztms.blogmgnt.pojo.BlogComment;
import com.gztms.blogmgnt.service.BlogCommentService;
import com.gztms.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Zoey
 * @date 2023/5/2 12:31
 * @Description TODO
 **/
@RestController
@RequestMapping("/blog/comment")
public class BlogCommentController {

    @Autowired
    private BlogCommentService commentService;

    /**
     * 查询评论
     * @param blogId
     * @param pageNum
     * @param pageSize
     * @return
     */
    @GetMapping("/getCommentList")
    public ResultUtil getCommentList(@RequestParam Integer blogId, @RequestParam Integer pageNum, @RequestParam Integer pageSize){
        return commentService.getCommentList(blogId,pageNum,pageSize);
    }

    @PostMapping("/addComment")
    public ResultUtil addComment(@RequestBody BlogComment blogComment){
        return commentService.addComment(blogComment);
    }
}
